package zhr.chapter5.MemberCardDemoApp.cardpackage;

public abstract class Card {
    String type;
    float amount;
    public Card(){

    }

    public Card(String type) {
        this.type = type;
    }

    public Card(String type, float amount) {
        this.type = type;
        this.amount = amount;
    }

    public String getType() {
        return type;
    }
    public boolean comsume(float totalPrice){
        if(this.amount>=this.shouldPay(totalPrice)){
            this.amount = this.amount - this.shouldPay(totalPrice);
            return true;
        }else {
            return false;
        }
    }
    public abstract float shouldPay(float totalPrice);
    public float getAmount(){
        return amount;
    }
    public void setAmount(float amount){
        this.amount=amount;
    }
}
